package com.licq.appserver.controller;

import com.licq.appserver.entity.ResultBean;
import com.licq.appserver.entity.UserBean;
import com.licq.appserver.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("getUser/{id}")
    @ApiOperation(value = "获取用户信息")
    public ResultBean<List<UserBean>> GetUser(@PathVariable @ApiParam("用户主键") int id) {
        ResultBean<List<UserBean>> resultBean = new ResultBean<>();
        resultBean.setCode("000000");
        resultBean.setMsg("返回成功");
        resultBean.setData(userService.queryById(id));
        return resultBean;
    }

}
